package com.ecoolex.ying.space.ws;

import com.ecoolex.framework.common.pojo.Page;
import com.ecoolex.framework.common.pojo.Pagination;
import com.ecoolex.framework.common.pojo.Sorting;
import com.ecoolex.ying.space.pojo.QueryGoodsCategoryDTO;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;
import com.ecoolex.framework.common.exception.BizException;
import com.ecoolex.ying.space.core.manager.GoodsCategoryManager;
import com.ecoolex.ying.space.entity.GoodsCategory;

import java.util.List;

@Service
public class GoodsCategoryServiceImpl implements GoodsCategoryService {

    @Autowired
    private GoodsCategoryManager goodsCategoryManager;

    @Override
    public GoodsCategory addCategory(GoodsCategory record, String createUser) throws BizException {
        return goodsCategoryManager.add(record, createUser);
    }

    @Override
    public GoodsCategory updateCategory(GoodsCategory record, String updateUser) throws BizException {
        return goodsCategoryManager.update(record, updateUser);
    }

    @Override
    public void deleteCategory(GoodsCategory record, String updateUser) throws BizException {
        goodsCategoryManager.delete(record, updateUser);

    }

    @Override
    public GoodsCategory getCategoryById(Integer categoryId) {
        return goodsCategoryManager.getById(categoryId);
    }

    @Override
    public List<GoodsCategory> queryCategoryByParentId(Integer parentCategoryId, Boolean isShow) {
        return goodsCategoryManager.queryByParentId(parentCategoryId, isShow);
    }

    @Override
    public Pagination<GoodsCategory> queryCategory(QueryGoodsCategoryDTO query, Sorting[] sorts, Page page) {
        return goodsCategoryManager.query(query, sorts, page);
    }

    @Override
    public GoodsCategory showCategory(GoodsCategory record, String updateUser) {
        return goodsCategoryManager.show(record, updateUser);
    }

    @Override
    public GoodsCategory hideCategory(GoodsCategory record, String updateUser) {
        return goodsCategoryManager.hide(record, updateUser);
    }

	@Override
	public Pagination<GoodsCategory> queryCategoryForH5(Integer parentCategoryId,  Page page) {
		return goodsCategoryManager.queryCategoryForH5(parentCategoryId, page);
	}

}
